import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 测量点信息信息 */
export interface MeasurePointInfo {
  id: number; // 数据id
  deviceTreeId: number; // 关联设备树id
  measurePointName: string; // 监测点名称
  measurePointNo: string; // 监测点编号
  dtuInfoId: number; // dtuId
  protocolId: number; // 检测表协议
  ctRate: number; // CT变比
  ptRate: number; // PT变比
  measureMeterNo: string; // 监测表号
  measureMeterContant: string; // 监测表容量
  installDate: Date; // 安装日期
  connectWay: string; // 接线方式
  voltageType: string; // 电压
  currentType: string; // 电流
  regId: string; // 设备注册id
  }

// 测量点信息 API
export const MeasurePointInfoApi = {
  // 查询测量点信息分页
  getMeasurePointInfoPage: async (params: any) => {
    return await request.get({ url: `/measure/point/page`, params })
  },

  // 查询测量点信息详情
  getMeasurePointInfo: async (id: number) => {
    return await request.get({ url: `/measure/point/get?id=` + id })
  },

  // 新增测量点信息
  createMeasurePointInfo: async (data: MeasurePointInfo) => {
    return await request.post({ url: `/measure/point/create`, data })
  },

  // 修改测量点信息
  updateMeasurePointInfo: async (data: MeasurePointInfo) => {
    return await request.put({ url: `/measure/point/update`, data })
  },

  // 删除测量点信息
  deleteMeasurePointInfo: async (id: number) => {
    return await request.delete({ url: `/measure/point/delete?id=` + id })
  },

  /** 批量删除测量点信息 */
  deleteMeasurePointInfoList: async (ids: number[]) => {
    return await request.delete({ url: `/measure/point/deleteList?ids=${ids.join(',')}` })
  },

  // 导出测量点信息 Excel
  exportMeasurePointInfo: async (params) => {
    return await request.download({ url: `/measure/point/exportExcel`, params })
  },
}
